package com.dailyblue.java.spring.boot.boot01.mapper;

import com.dailyblue.java.spring.boot.boot01.bean.Emp;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface EmpMapper {
    @Select("Select * from emp where empState=1")
    List<Emp> findAllEmp();
    @Update("update emp set empState=0 where empNo=#{id}")
    void deleteEmp(int id);
    @Insert("insert into emp values(null,#{ename},#{job},#{mgr},now(),#{sal},#{comm},#{deptNo},1)")
    void saveEmp(Emp emp);
    @Update("update emp set ename=#{ename},job=#{job},mgr=#{mgr},sal=#{sal},comm=#{comm},deptno=#{deptNo} where empno=#{empNo}")
    void updateEmp(Emp emp);
}
